package cn.song.entity;

import cn.song.annotation.EasyExcel;
import cn.song.config.convert.EasyExcelEnumConverter;
import cn.song.constants.enums.GenderEnum;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.*;

import java.util.Date;

/**
 * 测试EasyExcel
 *
 * @author SongRenShuo
 * @date 2025/01/05
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("user_model")
// @Accessors(chain = true) //与EasyExcel冲突 会读取不到值
@ExcelIgnoreUnannotated
@EqualsAndHashCode(callSuper = true)
public class UserlModel extends Model<UserlModel> {
    @ExcelProperty(value = "序号", index = 0)
    private String id;
    @ExcelProperty(value = "姓名", index = 1)
    private String name;
    @ExcelProperty(value = "生日", index = 2)
    @DateTimeFormat("yyyy年MM月dd日")
    private Date birthday;
    @ExcelProperty(value = "年龄", index = 3)
    private Integer age;
    @ExcelProperty(value = "性别", index = 4,converter = EasyExcelEnumConverter.class)
    @EasyExcel(type = GenderEnum.class)
    private Integer gender;
}
